using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DataStructure
{
    public class LinkedList2Queue<T> : IQueue<T>
    {
        private LinkedList02<T> list;
        
        public LinkedList2Queue()
        {
            list = new LinkedList02<T>();
        }
        public int Count => list.Count;

        public bool IsEmpty => list.IsEmpty;
        
        //入队
        public void Enqueue(T data)
        {
            list.AddLast(data);
        }
        //出队
        public T Dequeue()
        {
            return list.RemoveFirst();
        }
        //查看队首元素
        public T Peek()
        {
            return list.GetFirst();
        }
        public override string ToString()
        {
            return "Queue front" + list.ToString() +"tail";
        }
    }
}